<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of VMT_VelVectMagDir</title>
  <meta name="keywords" content="VMT_VelVectMagDir">
  <meta name="description" content="Computes the magnitude and direction of velocity vectors given the east">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- menu.html VMT_4.0_dev -->
<h1>VMT_VelVectMagDir
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Computes the magnitude and direction of velocity vectors given the east</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function [xo,yo,mag,dir] = VMT_VelVectMagDir(xi,yi,Veast,Vnorth) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Computes the magnitude and direction of velocity vectors given the east
 velocity and north velocity at specified points.  Positions x and y of
 the observations are passed through.

 P.R. Jackson, USGS, 1-15-09</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function [xo,yo,mag,dir] = VMT_VelVectMagDir(xi,yi,Veast,Vnorth)</a>
0002 <span class="comment">% Computes the magnitude and direction of velocity vectors given the east</span>
0003 <span class="comment">% velocity and north velocity at specified points.  Positions x and y of</span>
0004 <span class="comment">% the observations are passed through.</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% P.R. Jackson, USGS, 1-15-09</span>
0007 
0008 <span class="comment">%Compute the magnitude</span>
0009 
0010 mag = sqrt(Veast.^2 + Vnorth.^2);
0011 
0012 <span class="comment">%Determine the quadrant</span>
0013 indx1 = find(Veast &gt;= 0 &amp; Vnorth &gt;= 0);
0014 indx2 = find(Veast &gt;= 0 &amp; Vnorth &lt;= 0);
0015 indx3 = find(Veast &lt;= 0 &amp; Vnorth &lt;= 0);
0016 indx4 = find(Veast &lt;= 0 &amp; Vnorth &gt;= 0);
0017 
0018 <span class="comment">%Compute the direction in degrees from north (+CW)</span>
0019 dir = zeros(size(Veast));
0020 
0021 dir(indx1) = 90    - atand(abs(Vnorth(indx1)./Veast(indx1)));
0022 dir(indx2) = 180   - atand(abs(Veast(indx2)./Vnorth(indx2)));
0023 dir(indx3) = 270   - atand(abs(Vnorth(indx3)./Veast(indx3)));
0024 dir(indx4) = 360   - atand(abs(Veast(indx4)./Vnorth(indx4)));
0025 
0026 <span class="comment">%Pass position through</span>
0027 
0028 xo = xi;
0029 yo = yi;</pre></div>
<hr><address>Generated on Thu 21-Mar-2013 09:32:01 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>